package Controller;
import DAO.SqlHelper;
import Model.News;
import Service.NewService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;


public class ShowListServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        NewService service=new NewService();
        List<News> newList= service.FindAllNews();
        request.setAttribute("news", newList);
        request.getRequestDispatcher("ShowList.jsp").forward(request,response);
    }
}
